<?php
    /**
    * Module change logs
    * 09/29/2010        immanuel192         First create, based on Linklist module
    * 
    * 
    */

    if (!defined('EXPONENT')) exit('');

    $link = null;
    if (isset($_GET['id'])) {
        $_GET['id']=intval($_GET['id']); // antisql injection
        $link = $db->selectObject('imageslider_image','id='.$_GET['id']);
        if ($link) {
            $loc = unserialize($link->location_data);
        }
    }


    if ( exponent_permissions_check('administrate',$loc) || 
    exponent_permissions_check('configure',$loc)) {  

        $config = $db->selectObject('imageslidermodule_config',"location_data='".serialize($loc)."'");
        if ($config == null) {
            $config->orderby= 0;
            $config->image_col= 0;            
        }

        $form = imageslider_image::form($link, $config);
        $form->location($loc);
        $form->meta('action','save');

        $template = new template('imageslidermodule','_form_edit');
        $template->assign('is_edit',(isset($link->id)? 1 : 0));
        $template->assign('form_html',$form->toHTML());
        $template->output();
    } else {
        echo SITE_404_HTML;
    }

?>